package com.djx.controller;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.UploadFileRequest;
import com.djx.utils.OSSUtil;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * @ClassName: OSSController
 * @Description: TODO
 * @author: 星~
 * @date: 2021/9/29 0029 上午 9:50
 */
@RestController
@RequestMapping("/OSS")
public class OSSController {



    /**
     * 传统创建连接调用上传
     * @param file
     * @return
     */
    @SneakyThrows
    @RequestMapping("/uploadMsg")
    public Map uploadMsg01(@RequestParam("file") MultipartFile file) {
        return OSSUtil.uploadImg01(file.getInputStream(), file.getOriginalFilename());
    }


}

